package _240315;

import java.util.*;

public class Main240315 {
	
	private static int[][] board;
	private static int[][] chess;
	
	public static void main(String[] args) { 
		// 白色0 黑色1
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt(); // 棋盘大小
		int m = scanner.nextInt(); // 操作数
		chess = new int[n][n];
		board = new int[m][4];
		for (int i=0; i<m; i++) {
			board[i][0] = scanner.nextInt()-1;
			board[i][1] = scanner.nextInt()-1;
			board[i][2] = scanner.nextInt()-1;
			board[i][3] = scanner.nextInt()-1;
		}
		
		for (int i=0; i<m; i++) {
			for (int j=0; j<n; j++) {
				for (int k=0; k<n; k++) {
					if(j>=board[i][0] && j<=board[i][2] && k>=board[i][1] && k<=board[i][3]) {
						chess[j][k] = chess[j][k]==1 ? 0:1;
					}
				}
			}
			
		}
		// 输出
		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				System.out.print(chess[i][j]);
			}
			System.out.println();
		}
	}

}
